package Join;

public class RunnableLoop implements Runnable {
	public void run(){
		int max = 10;
		for (int i=0; i<max; i++){
			System.out.println(Thread.currentThread().getName() + " : " + i);
			try{
				Thread.sleep((long) (Math.random() * 10000));
			}catch (InterruptedException e){
				e.printStackTrace();
			}
		}	
	}
	
	public static void main (String args[]) throws InterruptedException{
		System.out.println("Mulai");
		Thread t = new Thread(new RunnableLoop());
		t.start();
		
		Thread t1 = new Thread(new RunnableLoop()); 
		t1.start();
		
		t.join();
		System.out.println("Selesai");
		//t1.join();
	}
}
